﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ExampleConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            #region 观察者模型设计
            //ConcreteSubject cs = new ConcreteSubject();
            //cs.Add(new ConcreteObserver(cs, "beijin"));
            //cs.Add(new ConcreteObserver(cs, "hangzhou"));
            //cs.State = "OK";
            //cs.Notify();
            //Console.Read();

            //股票的案例
            ConcreteStock stock = new ConcreteStock();
            stock.Add(new ConcreteInvestor(stock, "zhangsan", 12.5m));
            stock.Add(new ConcreteInvestor(stock, "lisi", 8.5M));
            for (var i = 16.5M; i > 0; i--)
            {
                stock.Price = i;
                stock.Notify();
            }
            Console.Read();
            #endregion


        }
    }
}
